<%@ page import="java.util.List" %>
<%@ page import="com.qf.pojo.Emp" %><%--
  Created by IntelliJ IDEA.
  com.qf.pojo.User: sun
  Date: 2022/9/7
  Time: 11:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>员工列表</title>
</head>
<body>
当前在线人数: <%=application.getAttribute("count")%>
<table align="center" border="1" cellspacing="0" bordercolor="red" cellpadding="5">
    <tr>
        <th>ID</th>
        <th>姓名</th>
        <th>工资</th>
        <th>年龄</th>
        <th>操作</th>
    </tr>
    <%
        Object emps = request.getAttribute("emps");
        if(emps == null) {
    %>
        <tr>
            <td colspan="5">员工列表为空</td>
        </tr>

    <%  } else {
            List<Emp> empList = (List<Emp>) emps;
            if(empList.size() == 0) {
          %>
                <tr>
                    <td colspan="5">员工列表为空</td>
                </tr>

    <%      }else {
                for (Emp emp : empList) {
    %>
                    <tr>
                        <td><%=emp.getId()%></td>
                        <td><%=emp.getName()%></td>
                        <td><%=emp.getSalary()%></td>
                        <td><%=emp.getAge()%></td>
                        <td>
                            <a href="/deleteEmp?id=<%=emp.getId()%>">删除</a>
                            <a href="/selectOneEmp?id=<%=emp.getId()%>">修改</a>
                        </td>
                    </tr>

    <%
                }

            }

        }   %>

</table>

</body>
</html>
